<html>
<body style="text-align:center;background-color:silver">


<?php

include('config.php');


/*
if(isset($_POST['del']))
{
$delArray=$_POST['delete'];

$id_delete="";

foreach($delArray as $val)
{
//$id_delete .="'".$val."',";
$id_delete.="'".$val."',";
}
$id_delete .="''";
//echo $id_delete;
$delete=mysql_query("Delete from addd where id in(".$id_delete.")");
if($id_delete)
echo $id_delete." are deleted";
}

*/

if(isset($_POST['del']))
{

$ddarray=$_POST['delete'];

$del="";
foreach($ddarray as $val)
{
   $del.="'".$val."',";
}
$del.="''";
$delete="Delete from addd where id in(".$del.")";
$kk=mysqli_query($con,$delete);
if($kk)
{
echo "successfully";
}
}


echo "<br/><br/><br/><br/><br/>";
echo $qu="select * from addd";
$result=mysqli_query($con,$qu);

echo "<form action='' method=POST > ";

echo"<table border=1 width=50% height=60% align=center padding-top=50% >";
echo "<th>ID</th>";
echo "<th>Name</th>";
echo "<th>Age</th>";
echo "<th><a href=inserts.php>Add</a></th>";
while($row=mysqli_fetch_array($result))
{


echo "<tr>";
echo "<td>".$row['ID']."</td>";
echo "<td>".$row['NAME']."</td>";
echo "<td>".$row['AGE']."</td>";

echo "<td><a href=deletes.php?id=".$row['ID'].">delete</a></td>";
echo "<td> <a href=edits.php?id=".$row['ID'].">edit</a></td>";

echo "<td><input type=checkbox name=delete[] value=".$row['ID'].">";
echo "</tr>";
}
echo "</table>";


?>

<input type="submit" name="del" value="Apply" />

</form>
</body>
</html>